import { DurationDto } from '../../common/model/commonModel';

// Top N 查询条件
export type TopNCondition = {
  name: string;
  parentService: string;
  normal: boolean;
  scope: string;
  topN: number;
  order: string;
};

// Top N 查询 请求参数定义
export type QueryTopNConditionReq = {
  duration: DurationDto;
  topNCondition: TopNCondition;
};

// 度量值 响应类型定义
export type SortMetrics = {
  name: string;
  id: string;
  value: string;
};

// 度量指标查询 实体定义
export type MetricsEntity = {
  scope: string;
  normal: boolean;
  serviceName: string;
  serviceInstanceName: string;
  endpointName: string;
  processName: string;
  destNormal: boolean;
  destServiceName: string;
  destServiceInstanceName: string;
  destEndpointName: string;
  destProcessName: string;
};

// 度量指标查询 条件定义
export type MetricsCondition = {
  name: string;
  entity: MetricsEntity;
};

// 度量指标查询条件 请求参数定义
export type QueryMetricsConditionReq = {
  labels: string[];
  duration: DurationDto;
  condition: MetricsCondition;
};

// 度量指标值 响应定义
export interface LabeledMetricsValuesResp {
  times: string[];
  values: any;
}

// 时间序列度量指标值 响应定义
export interface MetricsValuesResp {
  times: string[];
  values: number[];
}

export interface HeatmapResp {
  abscissa: string[];
  ordinate: string[];
  data: string[][];
}

// 批量查询指标 请求参数定义
export type QueryBatchMetricsConditionReq = {
  duration: DurationDto;
  names: string[];
  entity: MetricsEntity;
};

export interface BatchMetricsValuesResp {
  times: string[];
  values: string[][];
}
